    define("pages/jls_Txth/main", [
            "../../plugins/easyui/jquery-easyui-1.5.1/jquery.easyui.min",
            "../../plugins/easyui/jquery-easyui-1.5.1/easyloader",
            "../../plugins/artTemplate/artTemplate",
            "../../common/tools",
            "../../common/componts",
            "../../common/kss",
            "../../pages/jls_Txth/form",
            "../../pages/jls_Jbxx/JbxxShowHide.html.js",
            "../../pages/jls_Txth/TxthShowHide.html.js"
        ],
        function(require) {
            var comonts=require("../../common/componts");
            var txthForm=require("../../pages/jls_Txth/form");
            var tmp=require("../../pages/jls_Jbxx/JbxxShowHide.html");
            var tmpTxth=require("../../pages/jls_Txth/TxthShowHide.html");
            var kss=require("../../common/kss");
            var ryjbxxId="jbxxId";
            var txthId="txthId";
            var txth="txth";
            var selectid;
            var id;
            var jbxx="jbxx";

            var tableInit=function(){
                kss.initJbxxTable(ryjbxxId,{
                    singleSelect:true,
                    url:'/jls_jbxx/jbxxList',
                    detailFormatter : function(index, rowData) {
                        return '<table  style="height:60px;width:100%"><tr><td>户籍地详细地址：'
                            + (rowData.hjszd == null ? ""
                                : rowData.hjszd)
                            + '</td></tr><tr><td>现住地详细地址:'
                            + (rowData.xzd == null ? "" : rowData.xzd)
                            + '</td></tr><tr><td>办案单位:'
                            + (rowData.badw == null ? "" : rowData.badw)
                            + '</td></tr><tr><td>简要案情:'
                            + (rowData.aq == null ? "" : rowData.aq)
                            + '</td></tr></table>'
                    },
                    onDblClickRow:function(rowIndex, rowData){
                        if (rowData.rybh != undefined) {
                            $("input[name='ryRadio']")[rowIndex].checked = true;
                            $("#"+ryjbxxId).datagrid("selectRow", rowIndex);
                            var jbxx=$("#"+ryjbxxId).datagrid('getSelected');
                            txthForm.show(jbxx,{},refreshTable);

                            $('input').next().find('input[type=text]').css('background-color','#EBEBE4');
                            var myDate = new Date();
                            var str=myDate.toLocaleTimeString();
                        }
                    },
                    onClickRow:function(rowIndex, rowData){
                        if(selectid!=rowData.id){
                            $("input[name='ryRadio']")[rowIndex].checked = true;
                            selectid=rowData.id;
                        }else{
                            $("#"+ryjbxxId).datagrid("unselectRow",rowIndex);
                            $("input[name='ryRadio']")[rowIndex].checked = false;
                            $('#'+ryjbxxId).datagrid('clearSelections');
                            selectid="";
                        }
                    },
                    onSelect:function(rowIndex, rowData){
                        var jbxx = $('#'+ryjbxxId).datagrid('getSelected');
                        var flag = $("input[name='ryRadio']")[rowIndex].checked;
                        if(jbxx && !flag){
                            var rybh = jbxx.rybh;
                            $('#'+txthId).datagrid('loadData', { total: 0, rows: [] });
                            if (rybh != undefined) {
                                var opts = $("#"+txthId).datagrid("options");
                                $("#"+txthId).datagrid("clearSelections");
                                $('#'+txthId).datagrid('load',{
                                    'rybh': rybh,
                                });
                            }
                        }else {
                            $('#'+txthId).datagrid('loadData', { total: 0, rows: [] });
                        }
                    },
                    rightmenu:function(){
                    }

                });
                comonts.initTable(txthId,{
                    title: '提询登记',
                    url:"/jls_txth/txthList",
                    columns:[                    	
                        {field: 'id',title: 'ID',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="idRadio" id="idRadio"' + rowIndex + 'value="' + rowData.id + '" />';}},
                        {field: 'jsbh',title: '提审编号',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="jsbhRadio" id="jsbhRadio"' + rowIndex + 'value="' + rowData.jsbh + '" />';}},
                        {field: 'rybh',title: '人员编号',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="rybhRadio" id="rybhRadio"' + rowIndex + 'value="' + rowData.rybh + '" />';}},
                        {field: 'djrq',title: '登记日期',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="djrqRadio" id="djrqRadio"' + rowIndex + 'value="' + rowData.djrq + '" />';}},
                        {field: 'txr',title: '提询日',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="txrRadio" id="txrRadio"' + rowIndex + 'value="' + rowData.txr + '" />';}},
                        {field: 'type',title: '种类',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="typeRadio" id="typeRadio"' + rowIndex + 'value="' + rowData.type + '" />';}},
                        {field: 'gx',title: '关系',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="gxRadio" id="gxRadio"' + rowIndex + 'value="' + rowData.gx + '" />';}},
                        {field: 'txdz',title: '通讯地址',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="txdzRadio" id="txdzRadio"' + rowIndex + 'value="' + rowData.txdz + '" />';}},
                        {field: 'blr',title: '办理人',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="blrRadio" id="blrRadio"' + rowIndex + 'value="' + rowData.blr + '" />';}},
                        {field: 'zynr',title: '主要内容',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="zynrRadio" id="zynrRadio"' + rowIndex + 'value="' + rowData.zynr + '" />';}},
                        {field: 'bz',title: '备注',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="bzRadio" id="bzRadio"' + rowIndex + 'value="' + rowData.bz + '" />';}},
                        {field: 'dhhm',title: '电话号码',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="dhhmRadio" id="dhhmRadio"' + rowIndex + 'value="' + rowData.dhhm + '" />';}},
                        {field: 'state',title: '状态',formatter: function(value, rowData, rowIndex){return '<input type="radio" name="stateRadio" id="stateRadio"' + rowIndex + 'value="' + rowData.state + '" />';}},
                        ],
                    detailFormatter:function(index,rowData){
                        return ;
                    },
                    onClickRow:function(rowIndex, rowData){
                        if(id!=rowData.id){
                            $("input[name='txthRadio']")[rowIndex].checked = true;
                            $('#'+txthId).datagrid("selectRow", rowIndex);
                            id=rowData.id;
                        }else if(id==rowData.id){
                            $('#'+txthId).datagrid("unselectRow",rowIndex);
                            $("input[name='txthRadio']")[rowIndex].checked = false;
                            id="";
                        }
                    },
                    //双击事件
                    onDblClickRow:function(rowIndex, rowData){
                        $("input[name='txthRadio']")[rowIndex].checked = true;
                        $('#'+txthId).datagrid("selectRow", rowIndex);
                        id=rowData.id;
                        var jbxx = $('#jbxxId').datagrid('getSelected');
                        txthForm.show(jbxx,rowData,refreshTable);

                    },

                });
                $('#'+txthId).datagrid('resize',{
                    height:($(window).height() -280)
                });

            }
            var findTxth=function(){
                var val = $("#jqjsTree").tree('getSelected');
                var s_rybh = $("#s_rybh").textbox('getValue');
                var s_xm = $("#s_xm").textbox('getValue');
                //人员状态,单选框
                var opts = $('#'+ryjbxxId).datagrid("options");
                opts.url = "/jls_jbxx/jbxxList";
                $('#'+ryjbxxId).datagrid('clearSelections');
                $('#'+ryjbxxId).datagrid('load',{
                	'xm':s_xm,
                    'rybh':s_rybh,
                });
            }
            var initJsTree=function(){
                kss.initJsTree("jqjsTree","jbxxId",{});
            }
            var bindAction=function(){
                $("#txth_search").on("click",function(){
                    findTxth();
                });
                $("#txth_add").on("click",function(){
                    var ryjbxx=$("#"+ryjbxxId).datagrid('getSelected');
                    if(ryjbxx){
                        txthForm.show(ryjbxx,{},refreshTable);
                    }else{
                        $.messager.alert("提示","请选择要新增的记录!","info");
                    }
                });
                $("#txth_update").on("click",function(){
                    var ryjbxx=$("#"+ryjbxxId).datagrid('getSelected');
                    var txth=$("#"+txthId).datagrid('getSelected');
                    if(ryjbxx&&bjjl){
                        txthForm.show(ryjbxxtxth,refreshTable,{});
                        $('#rybhId').next().find('input[type=text]').css('background-color','#ebebe4');
                        $('#ryxmId').next().find('input[type=text]').css('background-color','#ebebe4');
                        $('#jshId').next().find('input[type=text]').css('background-color','#ebebe4');
                    }else{
                        $.messager.alert("提示","请选择要修改的记录!","info");
                    }
                });

                $(window).keydown(function(event) {
                    if (event.keyCode == 13) {
                        findtxth();
                    }
                });
                comonts.ShowHide(jbxx,tmp);
                comonts.ShowHide(txth,tmpTxth);
                $("#txth_print").on("click",function(){
                    var label="jls_txth";
                    var name="jls_txth";
                    var rybh=$("#"+ryjbxxId).datagrid('getSelected').rybh;
                    var url=comonts.getReportUrl(true,label,name,'rybh%3d'+rybh);
                    console.info(url);
                    addTab("Txth",url);
                });

            }
            var refreshTable=function(data){
                $('#'+txthId).datagrid('reload',{rybh:$('#'+ryjbxxId).datagrid('getSelected').rybh});
            }


            var initView=function(){
                tableInit();
                bindAction();
                initJsTree();

            }


            initView();
        });
